
class Period {
  final String id;
  final String title;
  final Duration duration;
  // final String datePattern;

   Period({
    required this.id,
    required this.title,
    required this.duration,
    // this.datePattern = 'd MMM HH:mm',
  });

  factory Period.minutes15() {
    return  Period(
      id: '15min',
      title: '15分',
      duration: const Duration(minutes: 15),
    );
  }

  factory Period.hours1() {
    return Period(
      id: '60min',
      title: '1时',
      duration: const Duration(hours: 1),
      // datePattern: 'd MMM y',
    );
  }

  factory Period.hours4() {
    return Period(
      id: '4hour',
      title: '4时',
      duration: const Duration(hours: 4),
    );
  }

  factory Period.day1() {
    return  Period(
      id: '1day',
      title: '1日',
      duration: const Duration(days: 1),
    );
  }

  factory Period.week1() {
    return Period(
      id: '1week',
      title: '1周',
      duration: const Duration(days: 7),
    );
  }

  factory Period.minutes1() {
    return Period(
      id: '1min',
      title: '1分',
      duration: const Duration(minutes: 1),
    );
  }

  factory Period.minutes5() {
    return Period(
      id: '5min',
      title: '5分',
      duration: const Duration(minutes: 5),
    );
  }

  factory Period.minutes30() {
    return Period(
      id: '30min',
      title: '30分',
      duration: const Duration(minutes: 30),
    );
  }

  factory Period.month1() {
    return Period(
      id: '1mon',
      title: '1月',
      duration: const Duration(days: 28),
      // datePattern: 'd MMM y',
    );
  }

}

